﻿package com.gengine.utils
{

    public class HTMLUtil extends Object
    {
        private static var delHtmlreg:RegExp = new RegExp("</?[^<>]+>", "gmi");
        private static var replaceTagLeft:RegExp = new RegExp("<", "g");
        private static var replaceTagRight:RegExp = new RegExp(">", "g");

        public function HTMLUtil()
        {
            return;
        }// end function

        public static function replaceHtmlTag(param1:String) : String
        {
            param1 = param1.replace(replaceTagLeft, "&lt;");
            param1 = param1.replace(replaceTagRight, "&gt;");
            return param1;
        }// end function

        public static function addColor(param1:String, param2:String, param3:String = "") : String
        {
            var _loc_4:* = "<font color=\'" + param2 + "\'";
            if (param3 != "")
            {
                _loc_4 = _loc_4 + (" face=\'" + param3 + "\'");
            }
            _loc_4 = _loc_4 + (">" + param1 + "</font>");
            return _loc_4;
        }// end function

        public static function addLink(param1:String, param2:String) : String
        {
            return "<font color=\'" + param2 + "\'><a href=\'event:0\'><u>" + param1 + "</u><a></font>";
        }// end function

        public static function removeHtml(param1:String) : String
        {
            if (param1)
            {
                return param1.replace(delHtmlreg, "");
            }
            return "";
        }// end function

        public static function getHtmlByComp(param1:String) : String
        {
            return param1.replace(/\[""\[/g, "<").replace(/\]""\]/g, ">");
        }// end function

    }
}
